//******************************************************************
//******************************************************************
//**********          ANts Peer To Peer Sources        *************
//
// ANts P2P realizes a third generation P2P net. It protects your
// privacy while you are connected and makes you not trackable, hiding
// your identity (ip) and crypting everything you are sending/receiving
// from others.

// Copyright (C) 2004  Roberto Rossi

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

package ants.p2p.gui;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.event.*;
import java.net.*;

import ants.p2p.*;
import ants.p2p.filesharing.*;
import ants.p2p.irc.*;
import ants.p2p.utils.addresses.*;
import ants.p2p.utils.indexer.*;

import com.borland.jbcl.layout.*;

import org.apache.log4j.*;
import javax.swing.border.*;

public class SettingsAntPanel
    extends JPanel {
  public static String pic = "backgrounds/bg4.jpg";
  public static final int maxNeighboursNumber = 50;
  public static final int minNeighboursNumber = 10;
  public static String lookAndFeel = "Trendy";
  public static String currentLanguage = "English";
  static File settings = new File(WarriorAnt.workingPath + "settings.ant");

  static Logger _logger = Logger.getLogger(SettingsAntPanel.class.getName());

  Image buffer;
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JComboBox jComboBox1 = new JComboBox();
  JLabel jLabel3 = new JLabel();
  GuiAnt caller;

  URL servers = null;
  JLabel jLabel4 = new JLabel();
  JSlider jSlider1 = new JSlider();
  JLabel jLabel5 = new JLabel();
  JButton jButton1 = new JButton();
  JLabel jLabel8 = new JLabel();
  JTextField jTextField4 = new JTextField();
  JLabel jLabel9 = new JLabel();
  JTextField jTextField5 = new JTextField();
  JComboBox jComboBox2 = new JComboBox();
  JButton jButton2 = new JButton();
  JLabel jLabel10 = new JLabel();
  JTextField jTextField3 = new JTextField();
  JLabel jLabel11 = new JLabel();
  JComboBox jComboBox3 = null;
  JButton jButton3 = new JButton();
  JCheckBox jCheckBox2 = new JCheckBox();
  JCheckBox jCheckBox1 = new JCheckBox();
  Border border1;
  JCheckBox jCheckBox3 = new JCheckBox();
  JCheckBox jCheckBox4 = new JCheckBox();
  JCheckBox jCheckBox5 = new JCheckBox();
  JLabel jLabel7 = new JLabel();
  JButton jButton4 = new JButton();
  JLabel jLabel12 = new JLabel();
  JSlider jSlider2 = new JSlider();
  JCheckBox jCheckBox6 = new JCheckBox();
  JTextField jTextField6 = new JTextField();
  JTextArea jTextArea1 = new JTextArea();
  JLabel jLabel15 = new JLabel();
  JTextField jTextField7 = new JTextField();
  JLabel jLabel13 = new JLabel();
  JScrollPane jScrollPane1 = new JScrollPane();
  JLabel jLabel14 = new JLabel();
  JTextField jTextField8 = new JTextField();
  JButton jButton5 = new JButton();
  JLabel jLabel16 = new JLabel();
  JPanel jPanel2 = new JPanel();
  XYLayout xYLayout2 = new XYLayout();
  JPanel jPanel3 = new JPanel();
  XYLayout xYLayout3 = new XYLayout();
  JPanel jPanel4 = new JPanel();
  XYLayout xYLayout4 = new XYLayout();
  JPanel jPanel5 = new JPanel();
  XYLayout xYLayout5 = new XYLayout();
  JLabel jLabel17 = new JLabel();
  JSlider jSlider3 = new JSlider();
  JSlider jSlider4 = new JSlider();
  JSlider jSlider5 = new JSlider();
  JLabel jLabel18 = new JLabel();
  JComboBox jComboBox4 = new JComboBox();
  JLabel jLabel19 = new JLabel();
  JSlider jSlider6 = new JSlider();
  JButton jButton6 = new JButton();
  JCheckBox jCheckBox7 = new JCheckBox();
  JComboBox jComboBox5 = new JComboBox(ji.JI.getAvaiableLanguages());
  JLabel jLabel6 = new JLabel();
  JButton jButton7 = new JButton();
  JButton jButton8 = new JButton();
  JPasswordField jPasswordField1 = new JPasswordField();
  JLabel jLabel20 = new JLabel();
  JLabel jLabel21 = new JLabel();
  JSlider jSlider7 = new JSlider();
  JCheckBox jCheckBox8 = new JCheckBox();
  JCheckBox jCheckBox9 = new JCheckBox("",
                                       ConnectionManager.searchIpOnGWebCache);

  public SettingsAntPanel(GuiAnt caller) {
    this.caller = caller;
    this.servers = this.getClass().getClassLoader().getResource("servers.ini");
    if (servers != null) {
      this.loadIrcServers();
    }
    this.jComboBox2.addItem("");
    if (this.jComboBox2.getItemCount() > 0) {
      ConnectionAntPanel.ircServer = (String)this.jComboBox2.getItemAt(0);
      this.jComboBox2.setSelectedIndex(0);
    }
    if (settings.exists()) {
      this.loadSettings();
    }
    try {
      Toolkit tk = Toolkit.getDefaultToolkit();
      MediaTracker mt = new MediaTracker(this);
      buffer = tk.getImage(this.getClass().getClassLoader().getResource(pic));
      mt.waitForAll();
    }
    catch (Exception e) {}
    try {
      jbInit();
    }
    catch (Exception ex) {
      _logger.error("", ex);
    }

    if (!settings.exists()) {
      final JFrame connectionDialog = new JFrame(ji.JI.i("ANts setup"));
      connectionDialog.getContentPane().setLayout(new FlowLayout(FlowLayout.
          CENTER));
      connectionDialog.getContentPane().add(new JLabel(ji.JI.i(
          "Select your connection speed: ")));
      connectionDialog.getContentPane().add(this.jComboBox1);
      JButton confirmConnection = new JButton(ji.JI.i("Ok"));
      confirmConnection.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          connectionDialog.setVisible(false);
        }
      });
      connectionDialog.getContentPane().add(confirmConnection);
      connectionDialog.pack();
      connectionDialog.setLocation(300, 300);
      SettingsAntPanel.setLookAndFeel(connectionDialog);
      connectionDialog.setVisible(true);
      while (connectionDialog.isVisible()) {
        try {
          Thread.currentThread().sleep(1000);
        }
        catch (InterruptedException ex1) {
        }
      }
      jPanel1.add(jComboBox1, new XYConstraints(200, 120, -1, -1));

      final JFrame ipDialog = new JFrame(ji.JI.i("ANts setup"));
      ipDialog.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));
      ipDialog.getContentPane().add(new JLabel(ji.JI.i("Check your ip") + ": "));
      ipDialog.getContentPane().add(this.jComboBox3);
      ipDialog.getContentPane().add(this.jCheckBox2);
      ipDialog.getContentPane().add(this.jCheckBox9);
      JButton confirmIp = new JButton(ji.JI.i("Ok"));
      confirmIp.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          ipDialog.setVisible(false);
        }
      });
      ipDialog.getContentPane().add(confirmIp);
      ipDialog.setSize(new Dimension(350, 150));
      ipDialog.setLocation(300, 300);
      SettingsAntPanel.setLookAndFeel(ipDialog);
      ipDialog.setVisible(true);
      while (ipDialog.isVisible()) {
        try {
          Thread.currentThread().sleep(1000);
        }
        catch (InterruptedException ex1) {
        }
      }
      jPanel3.add(jComboBox3, new XYConstraints(135, 15, 200, -1));
      jPanel3.add(jCheckBox2, new XYConstraints(245, 45, -1, -1));
      jPanel1.add(jCheckBox9, new XYConstraints(465, 52, -1, -1));

      JFileChooser jfc = new JFileChooser();
      jfc.setMultiSelectionEnabled(true);
      jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      int returnVal = jfc.showDialog(this, ji.JI.i("Add Share Directory"));
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File[] toAdd = jfc.getSelectedFiles();
        for (int x = 0; x < toAdd.length; x++) {
          BackgroundEngine.getInstance().addDirectory(toAdd[x]);
        }
      }

      jfc = new JFileChooser();
      jfc.setMultiSelectionEnabled(false);
      returnVal = jfc.showDialog(this, ji.JI.i("Select Browser"));
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File browser = jfc.getSelectedFile();
        HttpAntPanel.browserPath = browser.getAbsolutePath();
        this.jLabel16.setText(ji.JI.i("Browser") + ": " +
                              HttpAntPanel.browserPath);
      }
    }

    this.jTextField3.setText(WarriorAnt.password + "");
    this.jTextField4.setText(ConnectionAntPanel.ircPort + "");
    this.jTextField5.setText(ConnectionAntPanel.ircChannel);
    this.jTextField6.setText(WarriorAnt.getHttpServerHomePage());
    this.jTextField7.setText(WarriorAnt.getHttpLocalServerPort() + "");
    this.jTextField8.setText(WarriorAnt.getHttpProxyPort() + "");
    this.jTextArea1.setText(WarriorAnt.getHttpServerDescription());
    this.caller.cap.jTextField4.setText(ConnectionAntPanel.nick);
    try {
      jComboBox1.removeActionListener(jComboBox1.getActionListeners()[0]);
    }
    catch (Exception e) {}
    this.jComboBox1.setSelectedItem(WarriorAnt.ConnectionType);
    jComboBox1.addActionListener(new SettingsAntPanel_jComboBox1_actionAdapter(this));
    this.jSlider1.setValue(Ant.maxNeighbours < 10 ? 10 :
                           Ant.maxNeighbours > 30 ? 30 : Ant.maxNeighbours);
    this.jSlider2.setValue(MultipleSourcesDownloadManager.MaxSources);
    this.jSlider3.setValue(DownloadAntPanel.maxConcurrentDownloads);
    this.jSlider4.setValue(WarriorAnt.maxSecureConnections);
    this.jSlider5.setValue(WarriorAnt.maxPullRequestsToServe);
    this.jSlider6.setValue(BackgroundEngine.maxRemoteDocsToTrace);
    this.jSlider7.removeChangeListener(this.jSlider7.getChangeListeners()[0]);
    if (WarriorAnt.ConnectionType.equals("56K")) {
      this.jSlider7.setMaximum(10);
    }
    else
    if (WarriorAnt.ConnectionType.equals("ISDN")) {
      this.jSlider7.setMaximum(20);
    }
    else
    if (WarriorAnt.ConnectionType.equals("DSL")) {
      this.jSlider7.setMaximum(100);
    }
    else
    if (WarriorAnt.ConnectionType.equals("CABLE")) {
      this.jSlider7.setMaximum(1024);
    }
    else
    if (WarriorAnt.ConnectionType.equals("LAN T3")) {
      this.jSlider7.setMaximum(2 * 1024);
    }
    else
    if (WarriorAnt.ConnectionType.equals("LAN T2")) {
      this.jSlider7.setMaximum(5 * 1024);
    }
    else
    if (WarriorAnt.ConnectionType.equals("LAN T1")) {
      this.jSlider7.setMaximum(10 * 1024);
    }
    else
    if (WarriorAnt.ConnectionType.equals("LAN or Fiber Net")) {
      this.jSlider7.setMaximum(10 * 1024);
    }
    this.jSlider7.addChangeListener(new SettingsAntPanel_jSlider7_changeAdapter(this));
    this.jSlider7.setValue(NeighbourAnt.bandwidthLimit / 1024);
    this.jComboBox2.setSelectedItem(ConnectionAntPanel.ircServer);
    this.jComboBox3.setSelectedItem(this.caller.cap.getLocalInetAddress());
    this.jCheckBox3.setSelected(ConnectionAntPanel.autoReconnectIRC);
    this.jCheckBox4.setSelected(WarriorAnt.autoresumeFilesOnRun);
    this.jCheckBox5.setSelected(ConnectionAntPanel.searchPeersOnIRC);
    this.jCheckBox6.setSelected(WarriorAnt.isHttpEnabled());
    this.jCheckBox6_check();
    this.jCheckBox7.setSelected(QueryLinksDaemon.monitorClipboard);
    this.jCheckBox8.setSelected(ConnectionManager.publishIpOnGWebCache);
    this.jCheckBox9.setSelected(ConnectionManager.searchIpOnGWebCache);
    this.setIrcConnected(false);
    this.setIrcEnabled(false);
    this.storeSettings();
  }

  void jbInit() throws Exception {
    border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
    this.jPanel1.setOpaque(false);
    this.setLayout(borderLayout1);
    jPanel1.setLayout(xYLayout1);
    jLabel1.setMaximumSize(new Dimension(300, 15));
    jLabel1.setMinimumSize(new Dimension(300, 15));
    jLabel1.setPreferredSize(new Dimension(300, 15));
    jLabel1.setText(ji.JI.i("Max uploads to serve"));
    jLabel2.setMaximumSize(new Dimension(300, 15));
    jLabel2.setMinimumSize(new Dimension(300, 15));
    jLabel2.setPreferredSize(new Dimension(300, 15));
    jLabel2.setText(ji.JI.i("Max allowed secure connections"));
    jComboBox1.setMaximumSize(new Dimension(100, 32767));
    jComboBox1.setMinimumSize(new Dimension(100, 21));
    jComboBox1.setOpaque(true);
    jComboBox1.setPreferredSize(new Dimension(100, 21));
    jComboBox1.setToolTipText(ji.JI.i("Your connection speed"));
    jComboBox1.addItem("56K");
    jComboBox1.addItem("ISDN");
    jComboBox1.addItem("DSL");
    jComboBox1.addItem("CABLE");
    jComboBox1.addItem("LAN T3");
    jComboBox1.addItem("LAN T2");
    jComboBox1.addItem("LAN T1");
    jComboBox1.addItem("LAN or Fiber Net");
    jComboBox1.addActionListener(new SettingsAntPanel_jComboBox1_actionAdapter(this));
    jLabel3.setMaximumSize(new Dimension(300, 15));
    jLabel3.setMinimumSize(new Dimension(300, 15));
    jLabel3.setPreferredSize(new Dimension(300, 15));
    jLabel3.setText(ji.JI.i("Connection Speed"));
    jLabel4.setMaximumSize(new Dimension(300, 15));
    jLabel4.setMinimumSize(new Dimension(300, 15));
    jLabel4.setPreferredSize(new Dimension(300, 15));
    jLabel4.setText(ji.JI.i("Max neighbours number") + ": " + Ant.maxNeighbours);
    jSlider1.setMinimum(SettingsAntPanel.minNeighboursNumber);
    jSlider1.setMaximum(SettingsAntPanel.maxNeighboursNumber);
    jSlider1.setValue(Ant.maxNeighbours);
    jSlider1.setMaximumSize(new Dimension(100, 24));
    jSlider1.setMinimumSize(new Dimension(100, 24));
    jSlider1.setPreferredSize(new Dimension(100, 24));
    jSlider1.setToolTipText(ji.JI.i(
        "Max number of computer which you want to directly connect to"));
    jSlider1.setOpaque(false);
    jSlider1.addChangeListener(new SettingsAntPanel_jSlider1_changeAdapter(this));
    jPanel1.setBorder(border1);
    jPanel1.setMinimumSize(new Dimension(600, 700));
    jPanel1.setPreferredSize(new Dimension(600, 800));
    jLabel5.setMaximumSize(new Dimension(400, 15));
    jLabel5.setMinimumSize(new Dimension(400, 15));
    jLabel5.setPreferredSize(new Dimension(400, 15));
    jLabel5.setText(ji.JI.i("Download path") + ": " + WarriorAnt.downloadPath);
    jLabel7.setMaximumSize(new Dimension(400, 15));
    jLabel7.setMinimumSize(new Dimension(400, 15));
    jLabel7.setPreferredSize(new Dimension(400, 15));
    jLabel7.setText(ji.JI.i("Chuncks Home") + ": " + WarriorAnt.chunksHome);
    jButton1.setMaximumSize(new Dimension(160, 23));
    jButton1.setMinimumSize(new Dimension(160, 23));
    jButton1.setPreferredSize(new Dimension(160, 23));
    jButton1.setToolTipText(ji.JI.i(
        "Changes the path where your downloads are stored when finished"));
    jButton1.setText(ji.JI.i("Change Download Path"));
    jButton1.addActionListener(new SettingsAntPanel_jButton1_actionAdapter(this));
    jLabel8.setMaximumSize(new Dimension(80, 15));
    jLabel8.setMinimumSize(new Dimension(80, 15));
    jLabel8.setPreferredSize(new Dimension(80, 15));
    jLabel8.setText(ji.JI.i("IRC server"));
    jTextField4.setMaximumSize(new Dimension(50, 2147483647));
    jTextField4.setMinimumSize(new Dimension(50, 21));
    jTextField4.setPreferredSize(new Dimension(50, 21));
    jTextField4.setVisible(false);
    jLabel9.setText("Ch.");
    jTextField5.addFocusListener(new SettingsAntPanel_jTextField5_focusAdapter(this));
    jComboBox2.setOpaque(true);
    jComboBox2.setToolTipText(ji.JI.i("Select an IRC server"));
    jComboBox2.setEditable(true);
    jComboBox2.addActionListener(new SettingsAntPanel_jComboBox2_actionAdapter(this));
    jButton2.setActionCommand(ji.JI.i("Connect"));
    jButton2.setText(ji.JI.i("Connect"));
    jButton2.addActionListener(new SettingsAntPanel_jButton2_actionAdapter(this));
    jButton2.setEnabled(false);
    jButton2.setToolTipText(ji.JI.i(
        "Connect to the selected IRC server joining the specified channel"));
    this.setDebugGraphicsOptions(0);
    this.setMinimumSize(new Dimension(600, 700));
    this.setPreferredSize(new Dimension(600, 700));
    jLabel10.setMaximumSize(new Dimension(130, 15));
    jLabel10.setMinimumSize(new Dimension(130, 15));
    jLabel10.setPreferredSize(new Dimension(130, 15));
    jLabel10.setText(ji.JI.i("Bot password"));
    jTextField3.setOpaque(true);
    jTextField3.setToolTipText(ji.JI.i(
        "This is the password that other peers will use to require you the " +
        "OP status on IRC"));
    jTextField3.setText("");
    jTextField3.addFocusListener(new SettingsAntPanel_jTextField3_focusAdapter(this));
    jLabel11.setMaximumSize(new Dimension(150, 15));
    jLabel11.setMinimumSize(new Dimension(150, 15));
    jLabel11.setPreferredSize(new Dimension(150, 15));
    jLabel11.setText(ji.JI.i("IP or Hostname"));
    jTextField5.setOpaque(true);
    jTextField5.setToolTipText(ji.JI.i("Specify an IRC channel"));
    jTextField5.setText("");
    try {
      InetAddress[] addressList = InetAddress.getAllByName(InetAddress.
          getLocalHost().getHostName());
      this.jComboBox3 = new JComboBox();
      for (int h = 0; h < addressList.length; h++) {
        this.jComboBox3.addItem(addressList[h]);
      }
      boolean found = false;
      for (int x = 0; x < this.jComboBox3.getItemCount(); x++) {
        if ( ( ( (InetAddress)this.jComboBox3.getItemAt(x)).getHostAddress()).
            equals(this.caller.
                   cap.getLocalStringAddress())) {
          found = true;
        }
      }
      if (!found) {
        this.jComboBox3.addItem(this.caller.cap.getLocalStringAddress());
      }
    }
    catch (Exception e) {
      _logger.error("Not a valid IP address in settings panel field", e);
    }
    jButton3.setToolTipText(ji.JI.i("Refresh the ip address list"));
    jButton3.setText(ji.JI.i("Refresh"));
    jButton3.addActionListener(new SettingsAntPanel_jButton3_actionAdapter(this));
    jButton3.setVisible(false);
    jComboBox3.setToolTipText(ji.JI.i("<html><body>This is a list of the IP addresses currently<br>avaiable for your network " +
                                      "adapter,<br>please select your internet pubblic address</body></html>"));
    jComboBox3.setEditable(true);
    jComboBox3.addActionListener(new SettingsAntPanel_jComboBox3_actionAdapter(this));
    jCheckBox2.setMaximumSize(new Dimension(230, 23));
    jCheckBox2.setMinimumSize(new Dimension(230, 23));
    jCheckBox2.setOpaque(false);
    jCheckBox2.setPreferredSize(new Dimension(230, 23));
    jCheckBox2.setToolTipText(ji.JI.i(
        "If you have a static IP, you may want to select this to let ANts " +
        "remember it"));
    jCheckBox2.setText(ji.JI.i("Remember IP/Hostname value"));
    jCheckBox2.addActionListener(new SettingsAntPanel_jCheckBox2_actionAdapter(this));
    jCheckBox1.setMaximumSize(new Dimension(300, 23));
    jCheckBox1.setMinimumSize(new Dimension(300, 23));
    jCheckBox1.setOpaque(false);
    jCheckBox1.setPreferredSize(new Dimension(300, 23));
    jCheckBox1.setToolTipText(ji.JI.i(
        "Run ANts P2P without pressing start ants"));
    jCheckBox1.setText(ji.JI.i("Autostart ANts on run"));
    jCheckBox1.addActionListener(new SettingsAntPanel_jCheckBox1_actionAdapter(this));
    jCheckBox3.setMaximumSize(new Dimension(140, 23));
    jCheckBox3.setMinimumSize(new Dimension(140, 23));
    jCheckBox3.setPreferredSize(new Dimension(140, 23));
    jCheckBox3.setToolTipText(ji.JI.i(
        "Automatically reconnect to IRC if disconnected"));
    jCheckBox3.setText(ji.JI.i("Autoreconnect to IRC "));
    jCheckBox3.addActionListener(new SettingsAntPanel_jCheckBox3_actionAdapter(this));
    jCheckBox4.setMaximumSize(new Dimension(300, 23));
    jCheckBox4.setMinimumSize(new Dimension(300, 23));
    jCheckBox4.setPreferredSize(new Dimension(300, 23));
    jCheckBox4.setToolTipText(ji.JI.i(
        "Automatically search active sources for downloads once connected"));
    jCheckBox4.setText(ji.JI.i("Autoresume files on run"));
    jCheckBox4.addActionListener(new SettingsAntPanel_jCheckBox4_actionAdapter(this));
    jCheckBox5.setMaximumSize(new Dimension(140, 23));
    jCheckBox5.setMinimumSize(new Dimension(140, 23));
    jCheckBox5.setPreferredSize(new Dimension(140, 23));
    jCheckBox5.setToolTipText(ji.JI.i(
        "Activate the peer search process on the specified IRC channel"));
    jCheckBox5.setText(ji.JI.i("Search peers on IRC"));
    jCheckBox5.addActionListener(new SettingsAntPanel_jCheckBox5_actionAdapter(this));
    jButton4.setMaximumSize(new Dimension(160, 23));
    jButton4.setMinimumSize(new Dimension(160, 23));
    jButton4.setPreferredSize(new Dimension(160, 23));
    jButton4.setToolTipText(ji.JI.i("<html><body>Changes the path to the folder containing<br>the subfolder of the downloads " +
                                    "chucks (unfinished files parts)</body></html>"));
    jButton4.setText(ji.JI.i("Change Chuncks Home"));
    jButton4.addActionListener(new SettingsAntPanel_jButton4_actionAdapter(this));
    jSlider2.setMaximumSize(new Dimension(100, 24));
    jSlider2.setMinimumSize(new Dimension(100, 24));
    jSlider2.setPreferredSize(new Dimension(100, 24));
    jSlider2.setToolTipText(ji.JI.i(
        "Max number of sources per file during a download"));
    jSlider2.setMinimum(1);
    jSlider2.setMaximum(50);
    jSlider2.setValue(MultipleSourcesDownloadManager.MaxSources);
    jSlider2.addChangeListener(new SettingsAntPanel_jSlider2_changeAdapter(this));
    jLabel12.setMaximumSize(new Dimension(300, 15));
    jLabel12.setMinimumSize(new Dimension(300, 15));
    jLabel12.setPreferredSize(new Dimension(300, 15));
    jLabel12.setText(ji.JI.i("Max sources per download") + ": " +
                     MultipleSourcesDownloadManager.MaxSources);
    jCheckBox6.setText(ji.JI.i("Open http service"));
    jCheckBox6.setMaximumSize(new Dimension(200, 23));
    jCheckBox6.setMinimumSize(new Dimension(200, 23));
    jCheckBox6.setPreferredSize(new Dimension(200, 23));
    jCheckBox6.setToolTipText(ji.JI.i("<html><body>This is an advanced feature. The webserver is NOT embedded in ANts!<br>" +
                                      "You must be running an active webserver on your PC.<br>Please read the documentation " +
                                      "for further informations!</body></html>"));
    jCheckBox6.setSelected(true);
    jCheckBox6.addActionListener(new SettingsAntPanel_jCheckBox6_actionAdapter(this));
    jTextField6.setMinimumSize(new Dimension(100, 20));
    jTextField6.setPreferredSize(new Dimension(100, 20));
    jTextField6.setToolTipText(ji.JI.i(
        "The path to your homepage in your webserver."));
    jTextField6.setText("");
    jTextField6.addFocusListener(new SettingsAntPanel_jTextField6_focusAdapter(this));
    jTextArea1.setMinimumSize(new Dimension(200, 200));
    jTextArea1.setPreferredSize(new Dimension(200, 200));
    jTextArea1.setToolTipText(ji.JI.i(
        "A brief description of your webserver content!"));
    jTextArea1.setText("My Personal Web Site");
    jTextArea1.setLineWrap(true);
    jTextArea1.addFocusListener(new SettingsAntPanel_jTextArea1_focusAdapter(this));
    jLabel15.setMaximumSize(new Dimension(80, 15));
    jLabel15.setMinimumSize(new Dimension(80, 15));
    jLabel15.setPreferredSize(new Dimension(80, 15));
    jLabel15.setText(ji.JI.i("Home Page"));
    jTextField7.setMinimumSize(new Dimension(100, 20));
    jTextField7.setPreferredSize(new Dimension(100, 20));
    jTextField7.setToolTipText(ji.JI.i(
        "The local port of your ACTIVE and RUNNING webserver"));
    jTextField7.setText("");
    jTextField7.addFocusListener(new SettingsAntPanel_jTextField7_focusAdapter(this));
    jLabel13.setMaximumSize(new Dimension(80, 15));
    jLabel13.setMinimumSize(new Dimension(80, 15));
    jLabel13.setPreferredSize(new Dimension(80, 15));
    jLabel13.setText(ji.JI.i("Local Port"));
    jScrollPane1.setMinimumSize(new Dimension(200, 100));
    jScrollPane1.setPreferredSize(new Dimension(200, 100));
    jLabel14.setMaximumSize(new Dimension(80, 15));
    jLabel14.setMinimumSize(new Dimension(80, 15));
    jLabel14.setPreferredSize(new Dimension(80, 15));
    jLabel14.setText(ji.JI.i("Proxy port"));
    jTextField8.setMinimumSize(new Dimension(100, 20));
    jTextField8.setPreferredSize(new Dimension(100, 20));
    jTextField8.setToolTipText(ji.JI.i(
        "The local port which you access remote webserver through"));
    jTextField8.setText("");
    jTextField8.addFocusListener(new SettingsAntPanel_jTextField8_focusAdapter(this));
    jButton5.setMaximumSize(new Dimension(160, 23));
    jButton5.setMinimumSize(new Dimension(160, 23));
    jButton5.setPreferredSize(new Dimension(160, 23));
    jButton5.setToolTipText(ji.JI.i(
        "You must choose a valid browser to access the ANts features that " +
        "require it!"));
    jButton5.setText(ji.JI.i("Browser Location"));
    jButton5.addActionListener(new SettingsAntPanel_jButton5_actionAdapter(this));
    jLabel16.setMaximumSize(new Dimension(400, 15));
    jLabel16.setMinimumSize(new Dimension(400, 15));
    jLabel16.setPreferredSize(new Dimension(400, 15));
    jLabel16.setText(ji.JI.i("Browser") + ": " + HttpAntPanel.browserPath);
    jPanel2.setLayout(xYLayout2);
    jPanel2.setBorder(BorderFactory.createEtchedBorder());
    jPanel3.setBorder(BorderFactory.createEtchedBorder());
    jPanel3.setLayout(xYLayout3);
    jPanel4.setBorder(BorderFactory.createEtchedBorder());
    jPanel4.setLayout(xYLayout4);
    jPanel5.setLayout(xYLayout5);
    jPanel5.setBorder(BorderFactory.createEtchedBorder());
    jPanel5.setDebugGraphicsOptions(0);
    jLabel17.setMaximumSize(new Dimension(300, 15));
    jLabel17.setMinimumSize(new Dimension(300, 15));
    jLabel17.setPreferredSize(new Dimension(300, 15));
    jLabel17.setText(ji.JI.i("Max concurrent downloads") + ": " +
                     DownloadAntPanel.maxConcurrentDownloads);
    jSlider3.setMaximumSize(new Dimension(100, 24));
    jSlider3.setMinimumSize(new Dimension(100, 24));
    jSlider3.setMinimum(0);
    jSlider3.setMaximum(100);
    jSlider3.setPreferredSize(new Dimension(100, 24));
    jSlider3.setToolTipText(ji.JI.i("Max number of concurrent downloads"));
    jSlider3.addChangeListener(new SettingsAntPanel_jSlider3_changeAdapter(this));
    jSlider4.setMaximum(10000);
    jSlider4.setMinimum(100);
    jSlider4.setMaximumSize(new Dimension(100, 24));
    jSlider4.setMinimumSize(new Dimension(100, 24));
    jSlider4.setPreferredSize(new Dimension(100, 24));
    jSlider4.setToolTipText(ji.JI.i(
        "Max number of allowed secure channels with other ANts P2P net nodes."));
    jSlider4.addChangeListener(new SettingsAntPanel_jSlider4_changeAdapter(this));
    jSlider5.setMaximumSize(new Dimension(100, 24));
    jSlider5.setMinimumSize(new Dimension(100, 24));
    jSlider5.setPreferredSize(new Dimension(100, 24));
    jSlider5.setToolTipText(ji.JI.i(
        "Max number of upload to be served at a time"));
    jSlider5.setMinimum(4);
    jSlider5.setMaximum(100);
    jSlider5.addChangeListener(new SettingsAntPanel_jSlider5_changeAdapter(this));
    jLabel18.setMaximumSize(new Dimension(150, 15));
    jLabel18.setMinimumSize(new Dimension(150, 15));
    jLabel18.setPreferredSize(new Dimension(150, 15));
    jLabel18.setText(ji.JI.i("Look & Feel"));
    if (System.getProperty("java.version").startsWith("1.5")) {
      jComboBox4.addItem("Napkin (only JDK 1.4.x)");
      jComboBox4.addItem("Liquid (only JDK 1.4.x)");
    }
    else {
      jComboBox4.addItem("Napkin");
      jComboBox4.addItem("Liquid");
    }
    jComboBox4.addItem("Java");
    jComboBox4.addItem("System");
    jComboBox4.addItem("Trendy");
    jComboBox4.setToolTipText(ji.JI.i("Choose a nice skin your your ANts!"));
    jComboBox4.setSelectedItem(SettingsAntPanel.lookAndFeel);
    jComboBox4.addActionListener(new SettingsAntPanel_jComboBox4_actionAdapter(this));
    jLabel19.setMaximumSize(new Dimension(150, 15));
    jLabel19.setMinimumSize(new Dimension(150, 15));
    jLabel19.setPreferredSize(new Dimension(150, 15));
    jLabel19.setText(ji.JI.i("Remote indexing cache") + ": ");
    jSlider6.setMaximum(1000000);
    jSlider6.setMinimum(10000);
    jSlider6.setMinimumSize(new Dimension(150, 24));
    jSlider6.setPreferredSize(new Dimension(150, 24));
    jSlider6.setToolTipText(ji.JI.i("<html><body>This is the amount of file locally cached<br>in order to speed up yours " +
                                    "and others' searches</body></html>"));
    jSlider6.addChangeListener(new SettingsAntPanel_jSlider6_changeAdapter(this));
    jButton6.setMaximumSize(new Dimension(150, 34));
    jButton6.setMinimumSize(new Dimension(150, 34));
    jButton6.setPreferredSize(new Dimension(150, 34));
    jButton6.setToolTipText(ji.JI.i("Close this tab"));
    //jButton6.setText(ji.JI.i("Close"));
    jButton6.setIcon(new LabelIcon(ji.JI.i("Close"),
                                   DoubleBuffer.getInstance().getButton(13),
                                   jButton6));
    jButton6.addActionListener(new SettingsAntPanel_jButton6_actionAdapter(this));
    jCheckBox7.setMaximumSize(new Dimension(300, 23));
    jCheckBox7.setMinimumSize(new Dimension(300, 23));
    jCheckBox7.setPreferredSize(new Dimension(300, 23));
    jCheckBox7.setToolTipText(ji.JI.i(
        "Monitor the system clipboard for ants2k:// and ed2k:// links, notify " +
        "me when you find one"));
    jCheckBox7.setText(ji.JI.i("Monitor clipboard for ed2k & ants2k links"));
    jCheckBox7.addActionListener(new SettingsAntPanel_jCheckBox7_actionAdapter(this));
    jLabel6.setMaximumSize(new Dimension(150, 15));
    jLabel6.setMinimumSize(new Dimension(150, 15));
    jLabel6.setPreferredSize(new Dimension(150, 15));
    jLabel6.setText(ji.JI.i("Language"));
    jComboBox5.setToolTipText(ji.JI.i(
        "Select the current language for ANts P2P"));
    jComboBox5.setSelectedItem(SettingsAntPanel.currentLanguage);
    jComboBox5.addActionListener(new SettingsAntPanel_jComboBox5_actionAdapter(this));
    jButton7.setPreferredSize(new Dimension(89, 20));
    jButton7.setToolTipText(ji.JI.i(
        "Download the latest language pack avaiable for ANtsP2P"));
    jButton7.setText(ji.JI.i("Download pack"));
    jButton7.addActionListener(new SettingsAntPanel_jButton7_actionAdapter(this));
    jButton8.setPreferredSize(new Dimension(150, 26));
    jButton8.setToolTipText(ji.JI.i("<html><body>Optimize the local inidex of shared files,<br>this will take several " +
                                    "minutes and it will stop<br>your activity on the ANts net, but it will<br>" +
                                    "also improve your node performances</body></html>"));
    jButton8.setText("Optimize Index");
    jButton8.addActionListener(new SettingsAntPanel_jButton8_actionAdapter(this));
    jPasswordField1.setPreferredSize(new Dimension(70, 20));
    jPasswordField1.setToolTipText(ji.JI.i("The channel password if needed"));
    jLabel20.setMaximumSize(new Dimension(34, 15));
    jLabel20.setMinimumSize(new Dimension(34, 15));
    jLabel20.setPreferredSize(new Dimension(34, 15));
    jLabel20.setText("passw");
    jLabel21.setText(ji.JI.i("Upload Bandwidth") + ": " +
                     (NeighbourAnt.bandwidthLimit * 8) / 1024 + " Kbit/s");
    jSlider7.setPreferredSize(new Dimension(100, 24));
    jSlider7.setMaximum(10 * 1024);
    jSlider7.setMinimum(1);
    jSlider7.setToolTipText(ji.JI.i("This is the amount of bandwidth dedicated to each neighbour you are connected to"));
    jSlider7.addChangeListener(new SettingsAntPanel_jSlider7_changeAdapter(this));
    jCheckBox8.setText(ji.JI.i("Publish ip on GWebCache"));
    jCheckBox8.addActionListener(new SettingsAntPanel_jCheckBox8_actionAdapter(this));
    jCheckBox9.setPreferredSize(new Dimension(230, 23));
    jCheckBox9.setText(ji.JI.i("Search peers on GWebCache"));
    jCheckBox9.addActionListener(new SettingsAntPanel_jCheckBox9_actionAdapter(this));
    jPanel1.add(jTextField4, new XYConstraints(313, 238, -1, -1));
    jPanel1.add(jPanel2, new XYConstraints(0, 525, 700, 122));
    jPanel2.add(jButton1, new XYConstraints(15, 15, -1, -1));
    jPanel2.add(jButton4, new XYConstraints(15, 45, -1, -1));
    jPanel2.add(jButton5, new XYConstraints(15, 75, -1, -1));
    jPanel2.add(jLabel16, new XYConstraints(215, 85, -1, -1));
    jPanel2.add(jLabel7, new XYConstraints(215, 55, -1, -1));
    jPanel2.add(jLabel5, new XYConstraints(215, 25, -1, -1));
    jPanel1.add(jPanel3, new XYConstraints(0, 350, 700, 160));
    jPanel3.add(jLabel11, new XYConstraints(15, 15, -1, -1));
    jPanel3.add(jCheckBox1, new XYConstraints(15, 75, -1, -1));
    jPanel3.add(jCheckBox4, new XYConstraints(15, 100, -1, -1));
    jPanel3.add(jCheckBox2, new XYConstraints(245, 45, -1, -1));
    jPanel3.add(jComboBox3, new XYConstraints(185, 15, 200, -1));
    jPanel3.add(jButton3, new XYConstraints(400, 15, -1, -1));
    jPanel3.add(jLabel18, new XYConstraints(500, 100, -1, -1));
    jPanel3.add(jComboBox4, new XYConstraints(500, 120, 150, -1));
    jPanel3.add(jLabel19, new XYConstraints(500, 15, -1, -1));
    jPanel3.add(jSlider6, new XYConstraints(500, 40, -1, -1));
    jPanel3.add(jCheckBox7, new XYConstraints(15, 125, -1, -1));
    jPanel3.add(jComboBox5, new XYConstraints(340, 120, 150, -1));
    jPanel3.add(jLabel6, new XYConstraints(340, 75, -1, -1));
    jPanel3.add(jButton7, new XYConstraints(340, 95, 150, -1));
    jPanel3.add(jButton8, new XYConstraints(500, 70, -1, -1));
    jPanel3.add(jCheckBox8, new XYConstraints(15, 45, -1, -1));
    jPanel1.add(jPanel4, new XYConstraints(0, 225, 450, 113));
    jPanel4.add(jLabel8, new XYConstraints(15, 15, -1, -1));
    jPanel4.add(jLabel9, new XYConstraints(15, 45, -1, -1));
    jPanel4.add(jLabel10, new XYConstraints(15, 75, -1, -1));
    jPanel4.add(jComboBox2, new XYConstraints(115, 15, 155, -1));
    jPanel4.add(jTextField5, new XYConstraints(40, 45, 115, -1));
    jPanel4.add(jTextField3, new XYConstraints(155, 75, 115, -1));
    jPanel4.add(jButton2, new XYConstraints(290, 15, -1, -1));
    jPanel4.add(jCheckBox3, new XYConstraints(290, 45, -1, -1));
    jPanel4.add(jCheckBox5, new XYConstraints(290, 75, -1, -1));
    jPanel4.add(jPasswordField1, new XYConstraints(200, 45, -1, -1));
    jPanel4.add(jLabel20, new XYConstraints(160, 45, -1, -1));
    jPanel1.add(jPanel5, new XYConstraints(464, 85, 234, 252));
    jPanel5.add(jCheckBox6, new XYConstraints(15, 15, -1, -1));
    jPanel5.add(jLabel14, new XYConstraints(15, 45, -1, -1));
    jPanel5.add(jTextField8, new XYConstraints(115, 45, -1, -1));
    jPanel5.add(jTextField7, new XYConstraints(115, 75, -1, -1));
    jPanel5.add(jLabel13, new XYConstraints(15, 75, -1, -1));
    jPanel5.add(jTextField6, new XYConstraints(115, 105, -1, -1));
    jPanel5.add(jLabel15, new XYConstraints(15, 105, -1, -1));
    jPanel5.add(jScrollPane1, new XYConstraints(15, 135, -1, -1));
    jPanel1.add(jLabel4, new XYConstraints(0, 0, -1, -1));
    jPanel1.add(jSlider1, new XYConstraints(350, 0, -1, -1));
    jPanel1.add(jLabel1, new XYConstraints(0, 30, -1, -1));
    jPanel1.add(jLabel2, new XYConstraints(0, 60, -1, -1));
    jPanel1.add(jLabel3, new XYConstraints(0, 90, -1, -1));
    jPanel1.add(jComboBox1, new XYConstraints(350, 90, -1, -1));
    jPanel1.add(jLabel12, new XYConstraints(0, 120, -1, -1));
    jPanel1.add(jSlider2, new XYConstraints(350, 120, -1, -1));
    jPanel1.add(jLabel17, new XYConstraints(0, 150, -1, -1));
    jPanel1.add(jSlider3, new XYConstraints(350, 150, -1, -1));
    jPanel1.add(jSlider4, new XYConstraints(350, 60, -1, -1));
    jPanel1.add(jSlider5, new XYConstraints(350, 30, -1, -1));
    jPanel1.add(jButton6, new XYConstraints(464, 2, -1, -1));
    jPanel1.add(jLabel21, new XYConstraints(0, 180, -1, -1));
    jPanel1.add(jSlider7, new XYConstraints(350, 180, -1, -1));
    jPanel1.add(jCheckBox9, new XYConstraints(465, 52, -1, -1));
    jScrollPane1.getViewport().add(jTextArea1, null);
    this.add(jPanel1, BorderLayout.NORTH);
  }

  public void storeSettings() {
    ObjectOutputStream oos = null;
    try {
      oos = new ObjectOutputStream(new FileOutputStream(
          settings));
      oos.writeObject(Ant.getVersion());
      oos.writeInt(WarriorAnt.maxPullRequestsToServe);
      oos.writeInt(WarriorAnt.maxSecureConnections);
      oos.writeInt(WarriorAnt.blockSizeInDownload);
      oos.writeInt(MultipleSourcesDownloadManager.blocksPerSource);
      oos.writeInt(MultipleSourcesDownloadManager.MaxSources);
      oos.writeObject(WarriorAnt.ConnectionType);
      oos.writeInt(Ant.maxNeighbours);
      oos.writeObject(WarriorAnt.downloadPath);
      oos.writeObject(WarriorAnt.chunksHome);
      oos.writeObject(ConnectionAntPanel.lastRoutingPoint);
      oos.writeInt(ConnectionAntPanel.lastRoutingPointPort);
      oos.writeObject(ConnectionAntPanel.ircServer);
      oos.writeInt(ConnectionAntPanel.ircPort);
      oos.writeObject(ConnectionAntPanel.ircChannel);
      oos.writeObject(ConnectionAntPanel.nick);
      oos.writeBoolean(ConnectionAntPanel.autoReconnectIRC);
      oos.writeBoolean(ConnectionAntPanel.searchPeersOnIRC);
      oos.writeObject(WarriorAnt.password);
      oos.writeBoolean(this.jCheckBox2.isSelected());
      if (this.jCheckBox2.isSelected()) {
        oos.writeObject(this.caller.cap.getLocalStringAddress());
      }
      oos.writeBoolean(this.jCheckBox1.isSelected());
      oos.writeBoolean(WarriorAnt.autoresumeFilesOnRun);
      oos.writeObject(WarriorAnt.getHttpServerHomePage());
      oos.writeObject(WarriorAnt.getHttpServerDescription());
      oos.writeInt(WarriorAnt.getHttpLocalServerPort());
      oos.writeInt(WarriorAnt.getHttpProxyPort());
      oos.writeBoolean(WarriorAnt.isHttpEnabled());
      oos.writeObject(HttpAntPanel.browserPath);
      oos.writeObject(this.caller.cap.jTextField3.getText());
      oos.writeInt(DownloadAntPanel.maxConcurrentDownloads);
      oos.writeBoolean(BackgroundEngine.recursiveExplore);
      oos.writeObject(SettingsAntPanel.lookAndFeel);
      oos.writeInt(BackgroundEngine.maxRemoteDocsToTrace);
      oos.writeBoolean(QueryLinksDaemon.monitorClipboard);
      oos.writeObject(SettingsAntPanel.currentLanguage);
      oos.writeInt(NeighbourAnt.bandwidthLimit);
      oos.writeBoolean(ConnectionManager.publishIpOnGWebCache);
      oos.writeBoolean(ConnectionManager.searchIpOnGWebCache);
      oos.writeBoolean(BackgroundEngine.shareDownloadPath);
      oos.writeBoolean(Ant.proxied);
      if (Ant.proxied) {
        oos.writeObject(InetAddress.getByName(System.getProperty(
            "https.proxyHost")));
        oos.writeInt(Integer.parseInt(System.getProperty("https.proxyPort")));
      }
      oos.writeBoolean(this.caller.cap.jCheckBox4.isSelected());
      oos.close();
    }
    catch (Exception e) {
      _logger.error("", e);
      try {
        if (oos != null) {
          oos.close();
        }
      }
      catch (IOException ioe) {}
    }
  }

  public String getIrcPassword() {
    return this.jPasswordField1.getText();
  }

  public void loadIrcServers() {
    BufferedReader reader = null;
    try {
      reader = new BufferedReader(new InputStreamReader(servers.openStream()));
      String line = reader.readLine();
      while (!line.equals("[servers]")) {
        line = reader.readLine();
      }
      line = reader.readLine();
      while (! (line.indexOf("[") >= 0 && line.indexOf("]") >= 0)) {
        if (!line.equals("")) {
          line = line.substring(line.indexOf(":") + 1, line.length());
          line = line.substring(line.indexOf(":") + 1, line.length());
          line = line.substring(0, line.indexOf(":"));
          this.jComboBox2.addItem(line);
        }
        line = reader.readLine();
      }
    }
    catch (Exception e) {
      try {
        reader.close();
      }
      catch (Exception ex) {}
      _logger.error("IRC Server file not found");
    }
  }

  public void loadSettings() {
    ObjectInputStream ois = null;
    try {
      ois = new ObjectInputStream(new FileInputStream(settings));
      String settingsVersion = (String) ois.readObject();
      if (!Ant.getVersion().equals(settingsVersion)) {
        _logger.warn(
            "Non static settings file does not match ANts version: partial settings loaded");
      }
      WarriorAnt.maxPullRequestsToServe = ois.readInt();
      WarriorAnt.maxSecureConnections = ois.readInt();
      WarriorAnt.blockSizeInDownload = ois.readInt();
      MultipleSourcesDownloadManager.blocksPerSource = ois.readInt();
      MultipleSourcesDownloadManager.MaxSources = ois.readInt();
      WarriorAnt.ConnectionType = (String) ois.readObject();
      Ant.maxNeighbours = ois.readInt();
      WarriorAnt.downloadPath = (String) ois.readObject();
      WarriorAnt.chunksHome = (String) ois.readObject();
      ConnectionAntPanel.lastRoutingPoint = (String) ois.readObject();
      caller.cap.jTextField5.setText(ConnectionAntPanel.lastRoutingPoint);
      ConnectionAntPanel.lastRoutingPointPort = ois.readInt();
      caller.cap.jTextField6.setText(ConnectionAntPanel.lastRoutingPointPort +
                                     "");
      ConnectionAntPanel.ircServer = (String) ois.readObject();
      this.jComboBox2.setSelectedItem(ConnectionAntPanel.ircServer);
      ConnectionAntPanel.ircPort = ois.readInt();
      this.jTextField4.setText(ConnectionAntPanel.ircPort + "");
      ConnectionAntPanel.ircChannel = (String) ois.readObject();
      this.jTextField5.setText(ConnectionAntPanel.ircChannel + "");
      ConnectionAntPanel.nick = (String) ois.readObject();
      this.caller.cap.jTextField4.setText(ConnectionAntPanel.nick);
      ConnectionAntPanel.autoReconnectIRC = ois.readBoolean();
      ConnectionAntPanel.searchPeersOnIRC = ois.readBoolean();
      WarriorAnt.password = (String) ois.readObject();
      this.jTextField3.setText(WarriorAnt.password);
      this.jCheckBox2.setSelected(ois.readBoolean());
      if (this.jCheckBox2.isSelected()) {
        this.caller.cap.localStringAddress = (String) ois.readObject();
      }
      this.jCheckBox1.setSelected(ois.readBoolean());
      WarriorAnt.autoresumeFilesOnRun = ois.readBoolean();
      WarriorAnt.setHttpServerProperties( (String) ois.readObject(),
                                         (String) ois.readObject());
      WarriorAnt.setHttpLocalServerPort(ois.readInt());
      WarriorAnt.setHttpProxyPort(ois.readInt());
      WarriorAnt.httpEnabled(ois.readBoolean());
      HttpAntPanel.browserPath = (String) ois.readObject();
      this.caller.cap.jTextField3.setText( (String) ois.readObject());
      DownloadAntPanel.maxConcurrentDownloads = ois.readInt();
      BackgroundEngine.recursiveExplore = ois.readBoolean();
      SettingsAntPanel.lookAndFeel = (String) ois.readObject();
      BackgroundEngine.maxRemoteDocsToTrace = ois.readInt();
      QueryLinksDaemon.monitorClipboard = ois.readBoolean();
      SettingsAntPanel.currentLanguage = (String) ois.readObject();
      NeighbourAnt.bandwidthLimit = ois.readInt();
      ConnectionManager.publishIpOnGWebCache = ois.readBoolean();
      ConnectionManager.searchIpOnGWebCache = ois.readBoolean();
      ois.readBoolean();
      boolean proxy = ois.readBoolean();
      if (proxy) {
        ois.readObject();
        ois.readInt();
      }
      this.caller.cap.jCheckBox4.setSelected(ois.readBoolean());
      ois.close();
    }
    catch (Exception e) {
      _logger.error("Error in loading settings", e);
      try {
        ois.close();
      }
      catch (IOException ioe) {}
    }
  }

  public static void askForLanguage() {
    final JFrame languageDialog = new JFrame(ji.JI.i("ANts setup"));
    SettingsAntPanel.setLookAndFeel(languageDialog);
    languageDialog.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));
    languageDialog.getContentPane().add(new JLabel(ji.JI.i(
        "Select ANts language: ")));
    final JComboBox jComboBox = new JComboBox(ji.JI.getAvaiableLanguages());
    jComboBox.setSelectedItem(SettingsAntPanel.currentLanguage);
    jComboBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (jComboBox.getSelectedItem() != null &&
            currentLanguage != null &&
            ! ( (String) jComboBox.getSelectedItem()).equals(currentLanguage)) {
          currentLanguage = (String) jComboBox.getSelectedItem();
          ji.JI.setCurrentLanguage( (String) jComboBox.getSelectedItem());
        }
      }
    });
    languageDialog.getContentPane().add(jComboBox);
    JButton confirmConnection = new JButton(ji.JI.i("Ok"));
    confirmConnection.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        languageDialog.setVisible(false);
      }
    });
    languageDialog.getContentPane().add(confirmConnection);
    languageDialog.pack();
    languageDialog.setLocation(300, 300);
    SettingsAntPanel.setLookAndFeel(languageDialog);
    languageDialog.setVisible(true);
    while (languageDialog.isVisible()) {
      try {
        Thread.currentThread().sleep(1000);
      }
      catch (InterruptedException ex1) {
      }
    }
  }

  public static void loadStaticSettings() {
    if (!settings.exists()) {
      askForLanguage();
      return;
    }
    ObjectInputStream ois = null;
    try {
      ois = new ObjectInputStream(new FileInputStream(settings));
      String settingsVersion = (String) ois.readObject();
      if (!Ant.getVersion().equals(settingsVersion)) {
        String releaseMessage = "CHaNGe LoG\n" +
            "HTTP Servers are now indexed on supernodes.\n" +
            "Multicast discovery of other clients on the same LAN.\n" +
            "SSL tunneling -> PLEASE RUN ANTS ON PORT 443 to let people connect!\n";
        JOptionPane.showMessageDialog(null, releaseMessage, "Release Notice",
                                      JOptionPane.INFORMATION_MESSAGE);
        _logger.warn(
            "Static settings file does not match ANts version: partial settings loaded");
        com.limegroup.gnutella.bootstrap.BootstrapServerManager.bootstrapServers.delete();
        //ois.close();
        //settings.delete();
        return;
      }
      WarriorAnt.maxPullRequestsToServe = ois.readInt();
      WarriorAnt.maxSecureConnections = ois.readInt();
      WarriorAnt.blockSizeInDownload = ois.readInt();
      MultipleSourcesDownloadManager.blocksPerSource = ois.readInt();
      MultipleSourcesDownloadManager.MaxSources = ois.readInt();
      WarriorAnt.ConnectionType = (String) ois.readObject();
      Ant.maxNeighbours = ois.readInt();
      WarriorAnt.downloadPath = (String) ois.readObject();
      WarriorAnt.chunksHome = (String) ois.readObject();
      ConnectionAntPanel.lastRoutingPoint = (String) ois.readObject();
      ConnectionAntPanel.lastRoutingPointPort = ois.readInt();
      ConnectionAntPanel.ircServer = (String) ois.readObject();
      ConnectionAntPanel.ircPort = ois.readInt();
      ConnectionAntPanel.ircChannel = (String) ois.readObject();
      ConnectionAntPanel.nick = (String) ois.readObject();
      ConnectionAntPanel.autoReconnectIRC = ois.readBoolean();
      ConnectionAntPanel.searchPeersOnIRC = ois.readBoolean();
      WarriorAnt.password = (String) ois.readObject();
      if (ois.readBoolean()) {
        ois.readObject();
      }
      ois.readBoolean();
      WarriorAnt.autoresumeFilesOnRun = ois.readBoolean();
      WarriorAnt.setHttpServerProperties( (String) ois.readObject(),
                                         (String) ois.readObject());
      WarriorAnt.setHttpLocalServerPort(ois.readInt());
      WarriorAnt.setHttpProxyPort(ois.readInt());
      WarriorAnt.httpEnabled(ois.readBoolean());
      HttpAntPanel.browserPath = (String) ois.readObject();
      ois.readObject();
      DownloadAntPanel.maxConcurrentDownloads = ois.readInt();
      BackgroundEngine.recursiveExplore = ois.readBoolean();
      SettingsAntPanel.lookAndFeel = (String) ois.readObject();
      BackgroundEngine.maxRemoteDocsToTrace = ois.readInt();
      QueryLinksDaemon.monitorClipboard = ois.readBoolean();
      SettingsAntPanel.currentLanguage = (String) ois.readObject();
      NeighbourAnt.bandwidthLimit = ois.readInt();
      ois.readBoolean();
      ois.readBoolean();
      BackgroundEngine.shareDownloadPath = ois.readBoolean();
      boolean proxy = ois.readBoolean();
      if (proxy) {
        InetAddress proxyAddress = (InetAddress) ois.readObject();
        int port = ois.readInt();
        Ant.setProxied(proxyAddress, port);
      }
      ois.readBoolean();
      ois.close();
    }
    catch (Exception e) {
      _logger.error("Error in loading settings", e);
      try {
        ois.close();
      }
      catch (IOException ioe) {}
    }
  }

  void jComboBox1_actionPerformed(ActionEvent e) {
    WarriorAnt.ConnectionType = (String) jComboBox1.getSelectedItem();
    if (jComboBox1.getSelectedItem().equals("LAN or Fiber Net")) {
      /*
           WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 20);
           MultipleSourcesDownloadManager.blocksPerSource = 5;
           MultipleSourcesDownloadManager.MaxSources = 20;
           this.storeSettings();
       */
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(10 * 1024);
      this.jSlider7.setValue(10 * 1024);
      this.jSlider5.setValue(4);
      this.jSlider2.setValue(2);
      //this.jSlider1.setValue(1);
      this.jSlider1.setValue(50);
      this.storeSettings();
      jComboBox1.setSelectedItem("56K");
    }
    else if (jComboBox1.getSelectedItem().equals("LAN T1")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(10 * 1024);
      this.jSlider7.setValue(5 * 1024);
      this.jSlider6.setValue(100000);
      this.jSlider5.setValue(100);
      this.jSlider2.setValue(40);
      //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 29);
      this.jSlider1.setValue(30);
      this.storeSettings();
    }
    else if (jComboBox1.getSelectedItem().equals("LAN T2")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(5 * 1024);
      this.jSlider7.setValue(2 * 1024);
      this.jSlider6.setValue(100000);
      this.jSlider5.setValue(50);
      this.jSlider2.setValue(30);
      //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 17);
      this.jSlider1.setValue(30);
      this.storeSettings();
    }
    else if (jComboBox1.getSelectedItem().equals("LAN T3")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(2 * 1024);
      this.jSlider7.setValue(1024);
      this.jSlider6.setValue(70000);
      this.jSlider5.setValue(30);
      this.jSlider2.setValue(20);
      //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 17);
      this.jSlider1.setValue(30);
      this.storeSettings();
    }
    else if (jComboBox1.getSelectedItem().equals("CABLE")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(1024);
      this.jSlider7.setValue(500);
      this.jSlider6.setValue(50000);
      this.jSlider5.setValue(15);
      this.jSlider2.setValue(10);
      //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 11);
      this.jSlider1.setValue(20);
      this.storeSettings();
    }
    else if (jComboBox1.getSelectedItem().equals("DSL")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(100);
      this.jSlider7.setValue(30);
      this.jSlider6.setValue(10000);
      this.jSlider5.setValue(10);
      this.jSlider2.setValue(5);
      //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) + 5);
      this.jSlider1.setValue(15);
      this.storeSettings();
    }
    else if (jComboBox1.getSelectedItem().equals("ISDN")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(20);
      this.jSlider6.setValue(10000);
      this.jSlider7.setValue(10);
      this.jSlider5.setValue(6);
      this.jSlider2.setValue(3);
      //this.jSlider1.setValue(1);
      this.jSlider1.setValue(10);
      this.storeSettings();
    }
    else if (jComboBox1.getSelectedItem().equals("56K")) {
      WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 16);
      MultipleSourcesDownloadManager.blocksPerSource = 10;
      this.jSlider7.setMaximum(10);
      this.jSlider7.setValue(5);
      this.jSlider6.setValue(10000);
      this.jSlider5.setValue(4);
      this.jSlider2.setValue(2);
      //this.jSlider1.setValue(1);
      this.jSlider1.setValue(10);
      this.storeSettings();
    }
  }

  void jSlider1_stateChanged(ChangeEvent e) {
    this.jLabel4.setText(ji.JI.i("Max neighbours number") + ": " +
                         jSlider1.getValue());
    Ant.maxNeighbours = this.jSlider1.getValue();
    if (FrameAnt.getInstance(null).getGuiAnt() != null &&
        FrameAnt.getInstance(null).getGuiAnt().getConnectionAntPanel() != null &&
        FrameAnt.getInstance(null).getGuiAnt().getConnectionAntPanel().
        connectionManager != null) {
      FrameAnt.getInstance(null).getGuiAnt().getConnectionAntPanel().
          connectionManager.resume();
    }
    this.storeSettings();
  }

  void jButton1_actionPerformed(ActionEvent e) {
    JFileChooser jfc = new JFileChooser();
    jfc.setMultiSelectionEnabled(false);
    jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int returnVal = jfc.showDialog(this, ji.JI.i("Select Directory"));
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File downloadTo = jfc.getSelectedFile();
      int length = downloadTo.getAbsolutePath().length();
      if (downloadTo.getAbsolutePath().charAt(length - 1) == '\\' ||
          downloadTo.getAbsolutePath().charAt(length - 1) == '/') {
        WarriorAnt.downloadPath = downloadTo.getAbsolutePath();
        this.jLabel5.setText(ji.JI.i("Download path") + ": " +
                             WarriorAnt.downloadPath);
        this.storeSettings();
      }
      else {
        WarriorAnt.downloadPath = downloadTo.getAbsolutePath() + "/";
        this.jLabel5.setText(ji.JI.i("Download path") + ": " +
                             WarriorAnt.downloadPath);
        this.storeSettings();
      }
    }
  }

  void jTextField5_focusLost(FocusEvent e) {
    ConnectionAntPanel.ircChannel = this.jTextField5.getText();
    this.storeSettings();
  }

  void jComboBox2_actionPerformed(ActionEvent e) {
    try {
      if (! ( (String)this.jComboBox2.getSelectedItem()).equals("")) {
        //InetAddress.getByName(((String)this.jComboBox2.getSelectedItem())).getHostAddress();
        ConnectionAntPanel.ircServer = ( (String)this.jComboBox2.
                                        getSelectedItem());
        ConnectionAntPanel.ircPort = Integer.parseInt(this.jTextField4.getText());
      }
      else {
        ConnectionAntPanel.ircServer = "";
        this.jComboBox2.setSelectedItem("");
        ConnectionAntPanel.ircPort = 6666;
        this.jTextField4.setText(6666 + "");
      }
      this.storeSettings();
    }
    catch (Exception ex) {
      ConnectionAntPanel.ircServer = "";
      this.jComboBox2.setSelectedItem("");
      ConnectionAntPanel.ircPort = 6666;
      this.jTextField4.setText(6666 + "");
    }
  }

  public void setIrcConnected(boolean val) {
    if (val) {
      this.jTextField5.setEnabled(false);
      this.jComboBox2.setEnabled(false);
      this.jButton2.setText(ji.JI.i("Disconnect"));
      this.jButton2.setEnabled(true);
    }
    else {
      if (this.caller.cap != null && this.caller.cap.ircBot != null) {
        ChatAntPanel chatPanel = this.caller.cap.ircBot.getChatPanel();
        if (chatPanel != null) {
          chatPanel.setChannel(ji.JI.i("Channel") + ": ");
          //this.caller.cap.setIrcUsersNumberInChannel( -1, "");
          this.caller.getTabbedPane().remove(chatPanel);
          chatPanel.setUserList(null);
          chatPanel = null;
        }
        for (int x = this.caller.getTabbedPane().getComponentCount() - 1;
             x >= 0; x--) {
          if (this.caller.getTabbedPane().getComponentAt(x) instanceof
              ChatAntPanel) {
            this.caller.getTabbedPane().remove(x);
          }
        }
      }
      this.jTextField5.setEnabled(true);
      this.jComboBox2.setEnabled(true);
      this.jButton2.setText(ji.JI.i("Connect"));
      if (this.caller.cap != null && this.caller.cap.warriorAnt != null) {
        this.jButton2.setEnabled(!this.caller.cap.warriorAnt.isDisconnected());
      }
    }
  }

  public void setIrcEnabled(boolean val) {
    this.caller.cap.jButton9.setEnabled(val);
  }

  public boolean autoStartANts() {
    return this.jCheckBox1.isSelected();
  }

  public boolean autoResumeOnRun() {
    return this.jCheckBox4.isSelected();
  }

  void jButton2_actionPerformed(ActionEvent e) {
    if (this.jButton2.getText().equals(ji.JI.i("Connect"))) {
      try {
        this.jButton2.setEnabled(false);
        if (this.caller.cap.ircBot != null) {
          this.caller.cap.ircBot.shutdown();
        }
        /* IrcBot Setup*/
        if (!ConnectionAntPanel.ircServer.equals("")) {
          this.caller.cap.ircBot = new IrcBot(ConnectionAntPanel.nick,
                                              this.caller.cap);
          String password = this.jPasswordField1.getText();
          if (!password.equals("")) {
            this.caller.cap.ircBot.connect(ConnectionAntPanel.ircServer, 6667,
                                           password);
          }
          else {
            this.caller.cap.ircBot.connect(ConnectionAntPanel.ircServer);
          }
          Thread.sleep(2000);
          this.caller.cap.ircBot.joinChannel(ConnectionAntPanel.ircChannel);
          Thread.sleep(3000);
          this.caller.cap.ircBot.refreshUsers(ConnectionAntPanel.ircChannel);
          //this.caller.cap.jButton9.setEnabled(true);
          //this.setIrcEnabled(true);
          //this.setIrcConnected(true);
          if (!this.caller.cap.isFirewallChecked()) {
            this.caller.cap.jLabel23.setText(ji.JI.i(
                "Your firewall is being probed..."));
          }
        }
        /*Fine IrcBot setup*/
        this.jButton2.setEnabled(true);
      }
      catch (Exception ex) {
        this.setIrcConnected(false);
        this.setIrcEnabled(false);
        _logger.error("IRC not started: " + ex.getMessage());
        if (ex.getMessage().toLowerCase().indexOf("nickname is already in use") >=
            0) {
          JOptionPane.showMessageDialog(this,
                                        ji.JI.i("Nickname is already in use"),
                                        ji.JI.i("Error in starting IRC"),
                                        JOptionPane.ERROR_MESSAGE);
        }
        this.jButton2.setEnabled(true);
        final SwingWorker worker = new SwingWorker() {
          public Object construct() {
            caller.cap.ircBot.autoReconnect();
            return null;
          }
        };
        worker.start();
      }
    }
    else {
      try {
        this.jButton2.setEnabled(false);
        if (this.caller.cap.ircBot != null) {
          this.caller.cap.ircBot.shutdown();
        }
        this.setIrcEnabled(false);
        this.setIrcConnected(false);
        this.jButton2.setEnabled(true);
      }
      catch (Exception ex) {
        this.jButton2.setEnabled(true);
        _logger.error("Error in IRC swithcing", ex);
      }
    }
  }

  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (buffer != null) {
      int posX = (this.getWidth() - 650) / 2;
      int posY = (this.getHeight() - 550) / 2;
      if (posX < 0) {
        posX = 0;
      }
      if (posY < 0) {
        posY = 0;
      }
      g.drawImage(buffer, posX, posY, this);
    }
  }

  void jTextField3_focusLost(FocusEvent e) {
    WarriorAnt.password = this.jTextField3.getText();
    this.storeSettings();
  }

  public void addNATInetaddress(InetAddress nat) {
    for(int x = 0; x < this.jComboBox3.getItemCount(); x++){
      if(this.jComboBox3.getItemAt(x).toString().equals(nat.toString())){
        if(this.jComboBox3.getSelectedIndex() != x){
          this.jComboBox3.setSelectedIndex(x);
        }
        return;
      }
    }
    this.jComboBox3.addItem(nat);
    this.jComboBox3.setSelectedItem(nat);
  }

  public void resetInetaddress() {
    try {
      if(ants.p2p.utils.net.UPnPManager.instance().mappingsExist()) return;
      this.caller.cap.localStringAddress = null;
      InetAddress[] addressList = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
      this.jComboBox3.removeAllItems();
      for (int h = 0; h < addressList.length; h++) {
        this.jComboBox3.addItem(addressList[h]);
      }
      boolean found = false;
      for (int x = 0; x < this.jComboBox3.getItemCount(); x++) {
        if ( ( ( (InetAddress)this.jComboBox3.getItemAt(x)).getHostAddress()).equals(this.caller.cap.getLocalStringAddress())) {
          found = true;
        }
      }
      if (!found) {
        InetAddress address = this.caller.cap.getLocalInetAddress();
        this.jComboBox3.addItem(address);
        this.jComboBox3.setSelectedItem(address);
      }
    }
    catch (Exception ex) {
      _logger.error("Not a valid IP address in settings panel field", ex);
    }
  }

  void jButton3_actionPerformed(ActionEvent e) {
    this.resetInetaddress();
  }

  void jComboBox3_actionPerformed(ActionEvent e) {
    try {
      if (this.jComboBox3.getSelectedItem() == null) {
        return;
      }
      else if (this.jComboBox3.getSelectedItem() instanceof String) {
        InetAddress address = InetAddress.getByName( (String)this.jComboBox3.getSelectedItem());
        this.caller.cap.localStringAddress = (String)this.jComboBox3.getSelectedItem();
        if(this.caller.cap.warriorAnt != null)
          this.caller.cap.warriorAnt.setLocalInetAddress((String)this.jComboBox3.getSelectedItem());
        boolean found = false;
        for (int x = 0; x < this.jComboBox3.getItemCount(); x++) {
          if (this.jComboBox3.getItemAt(x).equals(address)) {
            found = true;
            break;
          }
        }
        if (!found) {
          this.jComboBox3.addItem(address);
        }
        this.caller.cap.jLabel9.setText("IP: " + this.caller.cap.localStringAddress);
        this.storeSettings();
      }
      else if (this.jComboBox3.getSelectedItem() instanceof InetAddress) {
        this.caller.cap.localStringAddress = ( (InetAddress)this.jComboBox3.
                                              getSelectedItem()).getHostAddress();
        if(this.caller.cap.warriorAnt != null)
          this.caller.cap.warriorAnt.setLocalInetAddress((String)this.jComboBox3.getSelectedItem());
        this.caller.cap.jLabel9.setText("IP: " + this.caller.cap.localStringAddress);
        this.storeSettings();
      }
      else {
        throw new Exception("Not a valid IP address in settings panel field");
      }
    }
    catch (Exception ex) {
      JOptionPane.showMessageDialog(this,
                                    ji.JI.i("Not a valid IP address typed: ") +
                                    this.jComboBox3.getSelectedItem() + ji.JI.i("\nthe address must be like xxx.xxx.xxx.xxx\nor a host address address.myhost.net"),
                                    ji.JI.i("Address error"),
                                    JOptionPane.ERROR_MESSAGE);
      this.jComboBox3.setSelectedItem(this.caller.cap.getLocalInetAddress());
      _logger.error("Not a valid IP address in settings panel field", ex);
    }
  }

  void jCheckBox2_actionPerformed(ActionEvent e) {
    this.storeSettings();
  }

  void jCheckBox1_actionPerformed(ActionEvent e) {
    this.storeSettings();
  }

  void jCheckBox3_actionPerformed(ActionEvent e) {
    ConnectionAntPanel.autoReconnectIRC = this.jCheckBox3.isSelected();
    this.storeSettings();
  }

  void jCheckBox4_actionPerformed(ActionEvent e) {
    WarriorAnt.autoresumeFilesOnRun = jCheckBox4.isSelected();
    this.storeSettings();
  }

  void jCheckBox5_actionPerformed(ActionEvent e) {
    ConnectionAntPanel.searchPeersOnIRC = this.jCheckBox5.isSelected();
    this.storeSettings();
  }

  void jButton4_actionPerformed(ActionEvent e) {
    JFileChooser jfc = new JFileChooser();
    jfc.setMultiSelectionEnabled(false);
    jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int returnVal = jfc.showDialog(this, ji.JI.i("Select Directory"));
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File downloadTo = jfc.getSelectedFile();
      int length = downloadTo.getAbsolutePath().length();
      if (downloadTo.getAbsolutePath().charAt(length - 1) == '\\' ||
          downloadTo.getAbsolutePath().charAt(length - 1) == '/') {
        WarriorAnt.chunksHome = downloadTo.getAbsolutePath();
        if (this.caller.dap != null) {
          this.caller.dap.loadInterrupted();
        }
        this.jLabel7.setText(ji.JI.i("Chuncks Home") + ": " +
                             WarriorAnt.chunksHome);
        this.storeSettings();
      }
      else {
        WarriorAnt.chunksHome = downloadTo.getAbsolutePath() + "/";
        if (this.caller.dap != null) {
          this.caller.dap.loadInterrupted();
        }
        this.jLabel7.setText(ji.JI.i("Chuncks Home") + ": " +
                             WarriorAnt.chunksHome);
        this.storeSettings();
      }
    }
  }

  void jSlider2_stateChanged(ChangeEvent e) {
    this.jLabel12.setText(ji.JI.i("Max sources per download") + ": " +
                          jSlider2.getValue());
    MultipleSourcesDownloadManager.MaxSources = this.jSlider2.getValue();
    this.storeSettings();
  }

  void jTextArea1_focusLost(FocusEvent e) {
    WarriorAnt.setHttpServerProperties(this.jTextField6.getText(),
                                       this.jTextArea1.getText());
    this.storeSettings();
  }

  void jTextField6_focusLost(FocusEvent e) {
    WarriorAnt.setHttpServerProperties(this.jTextField6.getText(),
                                       this.jTextArea1.getText());
    this.storeSettings();
  }

  void jTextField7_focusLost(FocusEvent e) {
    try {
      int port = Integer.parseInt(this.jTextField7.getText());
      WarriorAnt.setHttpLocalServerPort(port);
      this.storeSettings();
    }
    catch (Exception ex) {
      jTextField7.setText(WarriorAnt.getHttpLocalServerPort() + "");
    }
  }

  public void jCheckBox6_check() {
    this.jTextField7.setEnabled(jCheckBox6.isSelected());
    this.jTextField6.setEnabled(jCheckBox6.isSelected());
    this.jTextField8.setEnabled(jCheckBox6.isSelected());
    this.jTextArea1.setEnabled(jCheckBox6.isSelected());
  }

  void jCheckBox6_actionPerformed(ActionEvent e) {
    this.jCheckBox6_check();
    WarriorAnt.httpEnabled(jCheckBox6.isSelected());
    this.storeSettings();
  }

  void jTextField8_focusLost(FocusEvent e) {
    try {
      int port = Integer.parseInt(this.jTextField8.getText());
      WarriorAnt.setHttpProxyPort(port);
      this.storeSettings();
    }
    catch (Exception ex) {
      jTextField8.setText(WarriorAnt.getHttpProxyPort() + "");
    }
  }

  void jButton5_actionPerformed(ActionEvent e) {
    JFileChooser jfc = new JFileChooser();
    jfc.setMultiSelectionEnabled(false);
    int returnVal = jfc.showDialog(this, ji.JI.i("Select Browser"));
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File browser = jfc.getSelectedFile();
      HttpAntPanel.browserPath = browser.getAbsolutePath();
      this.jLabel16.setText(ji.JI.i("Browser") + ": " +
                            HttpAntPanel.browserPath);
      this.storeSettings();
    }
  }

  void jSlider3_stateChanged(ChangeEvent e) {
    if (jSlider3.getValue() > 0) {
      this.jLabel17.setText(ji.JI.i("Max concurrent downloads") + ": " +
                            jSlider3.getValue());
    }
    else {
      this.jLabel17.setText(ji.JI.i("Max concurrent downloads: inf"));
    }
    DownloadAntPanel.maxConcurrentDownloads = this.jSlider3.getValue();
    this.storeSettings();
  }

  void jSlider5_stateChanged(ChangeEvent e) {
    WarriorAnt.maxPullRequestsToServe = jSlider5.getValue();
    this.jLabel1.setText(ji.JI.i("Max download requests to serve") + ": " +
                         WarriorAnt.maxPullRequestsToServe);
    this.storeSettings();
  }

  void jSlider4_stateChanged(ChangeEvent e) {
    WarriorAnt.maxSecureConnections = jSlider4.getValue();
    this.jLabel2.setText(ji.JI.i("Max allowed secure connections") + ": " +
                         WarriorAnt.maxSecureConnections);
    this.storeSettings();
  }

  public static void setLookAndFeel() {
    try {
      String lnfName = UIManager.getCrossPlatformLookAndFeelClassName();
      if (SettingsAntPanel.lookAndFeel.equals("Liquid")) {
        lnfName = "com.birosoft.liquid.LiquidLookAndFeel";
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Java")) {
        lnfName = UIManager.getCrossPlatformLookAndFeelClassName();
      }
      else if (SettingsAntPanel.lookAndFeel.equals("System")) {
        lnfName = UIManager.getSystemLookAndFeelClassName();
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Napkin")) {
        lnfName = "napkin.NapkinLookAndFeel";
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Trendy")) {
        lnfName = "com.Trendy.swing.plaf.TrendyLookAndFeel";
      }
      UIManager.setLookAndFeel(lnfName);
    }
    catch (Exception ex) {
      _logger.error("Error in setting L&F", ex);
    }
  }

  public static void setLookAndFeel(FrameAnt frame) {
    try {
      String lnfName = UIManager.getCrossPlatformLookAndFeelClassName();
      if (SettingsAntPanel.lookAndFeel.equals("Liquid")) {
        lnfName = "com.birosoft.liquid.LiquidLookAndFeel";
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Java")) {
        lnfName = UIManager.getCrossPlatformLookAndFeelClassName();
      }
      else if (SettingsAntPanel.lookAndFeel.equals("System")) {
        lnfName = UIManager.getSystemLookAndFeelClassName();
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Napkin")) {
        lnfName = "napkin.NapkinLookAndFeel";
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Trendy")) {
        lnfName = "com.Trendy.swing.plaf.TrendyLookAndFeel";
      }
      UIManager.setLookAndFeel(lnfName);
      if (!System.getProperty("java.version").startsWith("1.5")) {
        SwingUtilities.updateComponentTreeUI(frame);
      }
      SwingUtilities.updateComponentTreeUI(frame.ga);
      SwingUtilities.updateComponentTreeUI(frame.ga.settingsScrollPane);
      SwingUtilities.updateComponentTreeUI(frame.ga.dsap);
      SwingUtilities.updateComponentTreeUI(frame.ga.shareap);
      frame.ga.shareap.sharedFilesTable.getTableHeader().updateUI();
    }
    catch (Exception ex) {
      _logger.error("Error in setting L&F", ex);
    }
  }

  public static void setLookAndFeel(JFrame frame) {
    try {
      String lnfName = UIManager.getCrossPlatformLookAndFeelClassName();
      if (SettingsAntPanel.lookAndFeel.equals("Liquid")) {
        lnfName = "com.birosoft.liquid.LiquidLookAndFeel";
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Java")) {
        lnfName = UIManager.getCrossPlatformLookAndFeelClassName();
      }
      else if (SettingsAntPanel.lookAndFeel.equals("System")) {
        lnfName = UIManager.getSystemLookAndFeelClassName();
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Napkin")) {
        lnfName = "napkin.NapkinLookAndFeel";
      }
      else if (SettingsAntPanel.lookAndFeel.equals("Trendy")) {
        lnfName = "com.Trendy.swing.plaf.TrendyLookAndFeel";
      }
      UIManager.setLookAndFeel(lnfName);
      SwingUtilities.updateComponentTreeUI(frame);
    }
    catch (Exception ex) {
      _logger.error("Error in setting L&F", ex);
    }
  }

  void jComboBox4_actionPerformed(ActionEvent e) {
    SettingsAntPanel.lookAndFeel = (String)this.jComboBox4.getSelectedItem();
    SettingsAntPanel.setLookAndFeel(FrameAnt.getInstance(null));
    this.storeSettings();
  }

  void jSlider6_stateChanged(ChangeEvent e) {
    BackgroundEngine.maxRemoteDocsToTrace = this.jSlider6.getValue();
    this.jLabel19.setText(ji.JI.i("Remote indexing cache") + ": " +
                          this.jSlider6.getValue());
    jSlider6.setToolTipText(ji.JI.i("<html><body>This is the amount of file locally cached<br>in order to speed up yours<br>" +
                                    "and others' searches: " +
                                    this.jSlider6.getValue() +
                                    " files</body></html>"));
    this.storeSettings();
  }

  void jButton6_actionPerformed(ActionEvent e) {
    this.caller.getTabbedPane().remove(this.caller.settingsScrollPane);
  }

  void jCheckBox7_actionPerformed(ActionEvent e) {
    QueryLinksDaemon.monitorClipboard = this.jCheckBox7.isSelected();
    this.storeSettings();
  }

  void jComboBox5_actionPerformed(ActionEvent e) {
    if ( (String) jComboBox5.getSelectedItem() != null &&
        currentLanguage != null &&
        ! ( (String) jComboBox5.getSelectedItem()).equals(currentLanguage)) {
      currentLanguage = (String) jComboBox5.getSelectedItem();
      ji.JI.setCurrentLanguage( (String) jComboBox5.getSelectedItem());
      this.storeSettings();
      JOptionPane.showMessageDialog(this,
                                    ji.JI.i(
                                        "You need to restart ANts for the modifies to take place!"),
                                    ji.JI.i("ANts P2P"),
                                    JOptionPane.PLAIN_MESSAGE);
    }
  }

  void jButton7_actionPerformed(ActionEvent e) {
    ji.JI.getInstance().downloadTranslationsAndReload();
    this.jComboBox5.setModel(new DefaultComboBoxModel(ji.JI.
        getAvaiableLanguages()));
    this.jComboBox5.setSelectedItem(SettingsAntPanel.currentLanguage);
  }

  void jButton8_actionPerformed(ActionEvent e) {
    int rv = JOptionPane.showConfirmDialog(this,
                                           ji.JI.i(
        "The process can take long and cannot be interrupted!"),
                                           ji.JI.i("Are you sure?"),
                                           JOptionPane.OK_CANCEL_OPTION,
                                           JOptionPane.QUESTION_MESSAGE);
    if (rv == JOptionPane.OK_OPTION) {
      try {
        BackgroundEngine.getInstance().synchronizeLocalIndex(true, false);
      }
      catch (Exception ex) {
        JOptionPane.showMessageDialog(this, ji.JI.i("Error"),
                                      ji.JI.i("Index optimization error"),
                                      JOptionPane.ERROR_MESSAGE);
      }
    }
  }

  void jSlider7_stateChanged(ChangeEvent e) {
    NeighbourAnt.bandwidthLimit = this.jSlider7.getValue() * 1024;
    this.jLabel21.setText(ji.JI.i("Upload Bandwidth") + ": " +
                          this.jSlider7.getValue() * 8 + " Kbit/s");
    this.storeSettings();
  }

  void jCheckBox8_actionPerformed(ActionEvent e) {
    ConnectionManager.publishIpOnGWebCache = jCheckBox8.isSelected();
    this.caller.cap.connectionManager.lastGWebCacheUpdate = 0;
    this.storeSettings();
  }

  void jCheckBox9_actionPerformed(ActionEvent e) {
    ConnectionManager.searchIpOnGWebCache = jCheckBox9.isSelected();
    this.storeSettings();
  }
}

class SettingsAntPanel_jComboBox1_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jComboBox1_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jComboBox1_actionPerformed(e);
  }
}

class SettingsAntPanel_jSlider1_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider1_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider1_stateChanged(e);
  }
}

class SettingsAntPanel_jButton1_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton1_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class SettingsAntPanel_jTextField3_focusAdapter
    extends java.awt.event.FocusAdapter {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jTextField3_focusAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void focusLost(FocusEvent e) {
    adaptee.jTextField3_focusLost(e);
  }
}

class SettingsAntPanel_jTextField5_focusAdapter
    extends java.awt.event.FocusAdapter {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jTextField5_focusAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void focusLost(FocusEvent e) {
    adaptee.jTextField5_focusLost(e);
  }
}

class SettingsAntPanel_jComboBox2_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jComboBox2_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jComboBox2_actionPerformed(e);
  }
}

class SettingsAntPanel_jButton2_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton2_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    final ActionEvent event = e;
    final SwingWorker worker = new SwingWorker() {
      public Object construct() {
        adaptee.jButton2_actionPerformed(event);
        return null;
      }
    };
    worker.start();
  }
}

class SettingsAntPanel_jButton3_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton3_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton3_actionPerformed(e);
  }
}

class SettingsAntPanel_jComboBox3_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jComboBox3_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jComboBox3_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox2_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox2_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox2_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox1_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox1_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox1_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox3_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox3_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox3_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox4_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox4_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox4_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox5_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox5_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox5_actionPerformed(e);
  }
}

class SettingsAntPanel_jButton4_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton4_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton4_actionPerformed(e);
  }
}

class SettingsAntPanel_jSlider2_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider2_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider2_stateChanged(e);
  }
}

class SettingsAntPanel_jTextArea1_focusAdapter
    extends java.awt.event.FocusAdapter {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jTextArea1_focusAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void focusLost(FocusEvent e) {
    adaptee.jTextArea1_focusLost(e);
  }
}

class SettingsAntPanel_jTextField6_focusAdapter
    extends java.awt.event.FocusAdapter {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jTextField6_focusAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void focusLost(FocusEvent e) {
    adaptee.jTextField6_focusLost(e);
  }
}

class SettingsAntPanel_jTextField7_focusAdapter
    extends java.awt.event.FocusAdapter {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jTextField7_focusAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void focusLost(FocusEvent e) {
    adaptee.jTextField7_focusLost(e);
  }
}

class SettingsAntPanel_jCheckBox6_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox6_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox6_actionPerformed(e);
  }
}

class SettingsAntPanel_jTextField8_focusAdapter
    extends java.awt.event.FocusAdapter {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jTextField8_focusAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void focusLost(FocusEvent e) {
    adaptee.jTextField8_focusLost(e);
  }
}

class SettingsAntPanel_jButton5_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton5_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton5_actionPerformed(e);
  }
}

class SettingsAntPanel_jSlider3_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider3_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider3_stateChanged(e);
  }
}

class SettingsAntPanel_jSlider5_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider5_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider5_stateChanged(e);
  }
}

class SettingsAntPanel_jSlider4_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider4_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider4_stateChanged(e);
  }
}

class SettingsAntPanel_jComboBox4_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jComboBox4_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jComboBox4_actionPerformed(e);
  }
}

class SettingsAntPanel_jSlider6_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider6_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider6_stateChanged(e);
  }
}

class SettingsAntPanel_jButton6_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton6_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton6_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox7_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox7_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox7_actionPerformed(e);
  }
}

class SettingsAntPanel_jComboBox5_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jComboBox5_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jComboBox5_actionPerformed(e);
  }
}

class SettingsAntPanel_jButton7_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton7_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton7_actionPerformed(e);
  }
}

class SettingsAntPanel_jButton8_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jButton8_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    final ActionEvent event = e;
    Thread runner = new Thread() {
      public void run() {
        adaptee.jButton8_actionPerformed(event);
      }
    };
    runner.setPriority(1);
    runner.start();
  }
}

class SettingsAntPanel_jSlider7_changeAdapter
    implements javax.swing.event.ChangeListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jSlider7_changeAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void stateChanged(ChangeEvent e) {
    adaptee.jSlider7_stateChanged(e);
  }
}

class SettingsAntPanel_jCheckBox8_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox8_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox8_actionPerformed(e);
  }
}

class SettingsAntPanel_jCheckBox9_actionAdapter
    implements java.awt.event.ActionListener {
  SettingsAntPanel adaptee;

  SettingsAntPanel_jCheckBox9_actionAdapter(SettingsAntPanel adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jCheckBox9_actionPerformed(e);
  }
}
